package com.cskaoyan.service;

import com.cskaoyan.bean.Order;
import com.cskaoyan.bean.Role;
import com.cskaoyan.bean.RoleExample;
import com.cskaoyan.mapper.RoleMapper;
import com.cskaoyan.vo.AdminVo;
import com.cskaoyan.vo.OptionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: libugu@cskaoyan.com
 * @date 2021/4/9 - 21:22
 */
@Service
public class RoleServiceImpl implements  RoleService {

    @Autowired
    RoleMapper roleMapper;
    @Override
    public List<OptionVo> query() {
        RoleExample roleExample = new RoleExample();
        List<Role> roles = roleMapper.selectByExample(roleExample);
        ArrayList<OptionVo> optionVos = new ArrayList<>();
        OptionVo optionVo = new OptionVo();
        for (Role role : roles) {
            optionVo.setValue(role.getId());
            optionVo.setLabel(role.getName());
            optionVos.add(optionVo);

        }
        return optionVos;
    }


    }


